package cn.kgm.makeGod.condition;

import cn.kgm.makeGod.Character;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-9-11 11:43
 * @Description: cn.kgm.makeGod.condition.StatCondition
 */
public class StatCondition implements Condition {

    private String stat; // "charm", "luck", etc.
    private Integer minValue;
    private Integer maxValue;

    public StatCondition() {
    }

    public StatCondition(String stat, Integer minValue, Integer maxValue) {
        this.stat = stat;
        this.minValue = minValue;
        this.maxValue = maxValue;
    }

    @Override
    public boolean check(Character actor, Character target, WorldState world) {
        int value;
        switch (stat) {
            case "charm":
                value = actor.getCharm();
                break;
            case "luck":
                value = actor.getLuck();
                break;
            case "level":
                value = actor.getLevel();
                break;
            default:
                return false;
        }

        if (minValue != null && value < minValue) return false;
        if (maxValue != null && value > maxValue) return false;

        return true;
    }
}
